//
//  T3ListModel.swift
//
//  Created by eme on 2017/4/10
//  Copyright (c) . All rights reserved.
//

import Foundation
import SwiftyJSON
import ModelProtocol

class T3ListModel: ModelProtocol {
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let kT3ListInternalIdentifierKey: String = "id"
    internal let kT3ListNameKey: String = "name"
    internal let kT3ListPicKey: String = "pic"
    
    
    // MARK: 属性
    var internalIdentifier: String
    var name: String
    var pic: String
    
    
    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    public required  init?(json: JSON) {
        internalIdentifier = json[kT3ListInternalIdentifierKey].stringValue
        name = json[kT3ListNameKey].stringValue
        pic = json[kT3ListPicKey].stringValue
        
    }
    
    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        
        dictionary.updateValue(internalIdentifier as AnyObject, forKey: kT3ListInternalIdentifierKey)
        
        
        dictionary.updateValue(name as AnyObject, forKey: kT3ListNameKey)
        
        
        dictionary.updateValue(pic as AnyObject, forKey: kT3ListPicKey)
        
        
        return dictionary
    }
    
    
}
